{include file='fcworker/fc_head'}
<style type="text/css">
    .ac-notice{
        width: 92%;
        margin: 8px auto;
        padding: 25px;
        line-height: 20px;
        color: #6b6b6b;
        text-align: left;
        display: block;
        font-size: 11px;
        box-shadow: 0 0  5px 5px rgba(0, 0, 0, 0.06);
        border-radius: 8px;
    }
    .btn-div{
        width: 100%;
        text-align: center;
        margin: 0 auto;
    }
    .sub-btn{
        background-color: #5c99f7;
        text-align: center;
        border: 0;
        border-radius: 50px;
        margin-top: 20px;
        color: #fff;
        font-size: 15px;
        font-weight: 400;
        width: 184px;
        height: 40px;
        line-height: 40px;
    }
    .qr_code{
        height: 240px;
        width: 240px;
    }
    #setTitle{
        line-height: 1.37rem !important;
        height: 1.37rem !important;
        background-size: 100% 1.37rem;
    }
</style>
<body style="background:#f8f8f8">
<div id="mescroll" class="mescroll">
    <div id="app">
        <a href="/{php echo createMobileUrl('x_index',array('themeid'=>$themeid));}" class="homeTag"><img src="{$_G['URL']['FCWORK_CSS']}images/homeBtn.png"></a>
        <div class="setTitle" id="setTitle">
            <a href="javascript:history.back(-1)"></a>
            抽奖奖品核销
        </div>
        <div class="h167"></div>
        <div class="setActive" id="showImg" >
            <ul>
                <li>
                    <p >客户预留姓名:{$info['username']}</p>
                </li>
                <li>
                    <p >客户预留手机号:{$info['mobile']}</p>
                </li>
                <li>
                    <p >客户兑换奖品名称:{$info['gift_title']}</p>
                </li>
            </ul>
            <div style="text-align: center;margin: 20px auto;">
                <img src="{$info['img']}" class="qr_code" id="qr_code">
            </div>
            <input type="hidden" name="f_id" id="f_id" value="{$info['f_id']}">
            <input type="hidden" name="uid" id="uid" value="{$info['uid']}">
            <input type="hidden" name="themeid" id="themeid" value="{$info['themeid']}">
            <div style="width: 100%;margin: 0 auto;text-align: center;">
                {if empty($info['notice'])}
                <button id="listen_btn" type="button" style="width: 80%;height: 40px;line-height: 40px;border-radius: 20px;border:none;background-color: #5c99f7;color: #fff;font-weight: 400;font-size: 15px;">奖品核销</button>
                {else}
                <button  disabled style="width: 91%;height: 40px;line-height: 40px;border-radius: 20px;border:none;background-color: #5c99f7;color: #fff;font-weight: 400;font-size: 15px;">{$info['notice']}</button>
                {/if}
            </div>
        </div>
        <div class="ac-notice">
            <div >1.请核对客户预留信息、预留手机号、兑换奖品信息，确保正确兑换</div>
            <div >2.其他错误信息，请根据提示排查或操作</div>
        </div>
        <div>

        </div>
    </div>
</div>
</body>
</html>
{include file='fcworker/fc_base_foot'}
<script type="text/javascript">
    const mescroll = new MeScroll("mescroll", {
        down: {
            auto: false,
            callback: () => {
                mescroll.endSuccess();
                setTimeout(() => {
                    window.location.reload();
                },500)
            }
        },
        up: {
            use: false
        }
    })
    $("#listen_btn").click(function () {
        $("#listen_btn").attr("disabled",true);
        layer.msg('确认进行该奖品的核销吗？',{
            time:0,
            btn:['确认','取消'],
            yes:function (index) {
                var f_id = $("#f_id").val();
                var themeid = $("#themeid").val();
                if ( f_id && themeid){
                    var postUrl="/{php echo createMobileUrl('X_Gifts',array('themeid'=>$themeid));}";
                    var jump_url = "/{php echo createMobileUrl('x_index',array('themeid'=>$themeid));}"
                    $.ajax({
                        url:postUrl,
                        dataType:'json',
                        method:'post',
                        data: {op:'sure_verify',f_id:f_id,themeid:themeid},
                        success:function (e) {
                            let data = e.data;
                            let error = e.error;
                            let msg = e.msg;
                            if (error){
                                layer.msg(msg);
                            }else{
                                layer.msg(msg);
                                self.location.href = jump_url;
                            }
                        },
                        fail:function (err) {
                            alert(err);
                        }
                    });
                }else{
                    layer.msg('发生了意外')
                }
                $("#listen_btn").attr("disabled",false);
                layer.closeAll();
            }
        });
    });
</script>